<template>
  <div>
    <el-date-picker
      v-model="selectTime"
      type="daterange"
      range-separator="-"
      start-placeholder="开始时间"
      end-placeholder="结束时间"
      value-format="YYYY-MM-DD"
      @change="gettiem"
    />
  </div>
</template>

<script setup>
import { onMounted, ref } from "vue";
import { getCurrentDate, getDateSevenDaysAgo } from "./uitile/data.js";

const selectTime = ref([]);
const fromData = ref({
  t1: "",
  t2: "",
});
onMounted(() => {
  selectTime.value = [
    getDateSevenDaysAgo() + " 23:59:59",
    getCurrentDate() + " 00:00:00",
  ];
  console.log(selectTime.value);
});

const gettiem = () => {
  console.log(selectTime.value);
  fromData.value.t1 = selectTime.value[0] + " 23:59:59";
  fromData.value.t2 = selectTime.value[1] + " 00:00:00";
  console.log(fromData.value);
};
</script>

<style lang="scss" scoped></style>
